package com.free.mini.core.serve.controller;

import com.free.mini.core.server.vo.req.AdminUserQueryDetailReqVO;
import com.free.mini.core.server.vo.resp.AdminUserLoginRespVO;
import org.springframework.web.bind.annotation.RestController;

import com.free.mini.common.base.ResultData;
import com.free.mini.core.serve.service.IAdminUserService;
import com.free.mini.core.server.api.AdminUserApi;
import com.free.mini.core.server.vo.req.AdminUserLoginReqVO;
import com.free.mini.core.server.vo.req.AdminUserRegisterReqVO;
import com.free.mini.core.server.vo.resp.AdminUserQueryDetailRespVO;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * @author dongsufeng
 * @version 4.0
 * @date 2023/8/19 12:52
 */
@RestController
@RequiredArgsConstructor
@Slf4j
public class AdminUserController implements AdminUserApi {

    private final IAdminUserService adminUserService;

    @Override
    public ResultData<Boolean> register(AdminUserRegisterReqVO reqVO) {
        return adminUserService.register(reqVO) ? ResultData.data(true) : ResultData.error();
    }

    @Override
    public ResultData<AdminUserLoginRespVO> login(AdminUserLoginReqVO reqVO) {
        return ResultData.data(adminUserService.login(reqVO));
    }

    @Override
    public ResultData<AdminUserQueryDetailRespVO> detail(AdminUserQueryDetailReqVO reqVO) {
        return ResultData.data(adminUserService.detail(reqVO));
    }
}
